home *** CD-ROM | disk | FTP | other *** search
/ Aminet 24 / Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso / Aminet / game / shoot / ADoom_src_1_1.lha / ADoom_src / wi_stuff.c < prev    next >
C/C++ Source or Header  |  1998-02-16  |  34KB  |  1,855 lines

  1. // Emacs style mode select   -*- C++ -*- 
  2. //-----------------------------------------------------------------------------
  3. //
  4. // $Id:$
  5. //
  6. // Copyright (C) 1993-1996 by id Software, Inc.
  7. //
  8. // This source is available for distribution and/or modification
  9. // only under the terms of the DOOM Source Code License as
  10. // published by id Software. All rights reserved.
  11. //
  12. // The source is distributed in the hope that it will be useful,
  13. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
  15. // for more details.
  16. //
  17. // $Log:$
  18. //
  19. // DESCRIPTION:
  20. //    Intermission screens.
  21. //
  22. //-----------------------------------------------------------------------------
  23.  
  24. static const char
  25. rcsid[] = "$Id: wi_stuff.c,v 1.7 1997/02/03 22:45:13 b1 Exp $";
  26.  
  27. #include <stdio.h>
  28.  
  29. #include "z_zone.h"
  30.  
  31. #include "m_random.h"
  32. #include "m_swap.h"
  33.  
  34. #include "i_system.h"
  35. #include "i_video.h"
  36.  
  37. #include "w_wad.h"
  38.  
  39. #include "g_game.h"
  40.  
  41. #include "r_local.h"
  42. #include "s_sound.h"
  43.  
  44. #include "doomstat.h"
  45.  
  46. // Data.
  47. #include "sounds.h"
  48.  
  49. // Needs access to LFB.
  50. #include "v_video.h"
  51.  
  52. #include "wi_stuff.h"
  53.  
  54. //
  55. // Data needed to add patches to full screen intermission pics.
  56. // Patches are statistics messages, and animations.
  57. // Loads of by-pixel layout and placement, offsets etc.
  58. //
  59.  
  60.  
  61. //
  62. // Different vetween registered DOOM (1994) and
  63. //  Ultimate DOOM - Final edition (retail, 1995?).
  64. // This is supposedly ignored for commercial
  65. //  release (aka DOOM II), which had 34 maps
  66. //  in one episode. So there.
  67. #define NUMEPISODES    4
  68. #define NUMMAPS        9
  69.  
  70.  
  71. // in tics
  72. //U #define PAUSELEN        (TICRATE*2) 
  73. //U #define SCORESTEP        100
  74. //U #define ANIMPERIOD        32
  75. // pixel distance from "(YOU)" to "PLAYER N"
  76. //U #define STARDIST        10 
  77. //U #define WK 1
  78.  
  79.  
  80. // GLOBAL LOCATIONS
  81. #define WI_TITLEY        2
  82. #define WI_SPACINGY            33
  83.  
  84. // SINGPLE-PLAYER STUFF
  85. #define SP_STATSX        50
  86. #define SP_STATSY        50
  87.  
  88. #define SP_TIMEX        16
  89. #define SP_TIMEY        (200-32)
  90.  
  91.  
  92. // NET GAME STUFF
  93. #define NG_STATSY        50
  94. #define NG_STATSX        (32 + SWAPSHORT(star->width)/2 + 32*!dofrags)
  95.  
  96. #define NG_SPACINGX            64
  97.  
  98.  
  99. // DEATHMATCH STUFF
  100. #define DM_MATRIXX        42
  101. #define DM_MATRIXY        68
  102.  
  103. #define DM_SPACINGX        40
  104.  
  105. #define DM_TOTALSX        269
  106.  
  107. #define DM_KILLERSX        10
  108. #define DM_KILLERSY        100
  109. #define DM_VICTIMSX            5
  110. #define DM_VICTIMSY        50
  111.  
  112.  
  113.  
  114.  
  115. typedef enum
  116. {
  117.     ANIM_ALWAYS,
  118.     ANIM_RANDOM,
  119.     ANIM_LEVEL
  120.  
  121. } animenum_t;
  122.  
  123. typedef struct
  124. {
  125.     int        x;
  126.     int        y;
  127.     
  128. } point_t;
  129.  
  130.  
  131. //
  132. // Animation.
  133. // There is another anim_t used in p_spec.
  134. //
  135. typedef struct
  136. {
  137.     animenum_t    type;
  138.  
  139.     // period in tics between animations
  140.     int        period;
  141.  
  142.     // number of animation frames
  143.     int        nanims;
  144.  
  145.     // location of animation
  146.     point_t    loc;
  147.  
  148.     // ALWAYS: n/a,
  149.     // RANDOM: period deviation (<256),
  150.     // LEVEL: level
  151.     int        data1;
  152.  
  153.     // ALWAYS: n/a,
  154.     // RANDOM: random base period,
  155.     // LEVEL: n/a
  156.     int        data2; 
  157.  
  158.     // actual graphics for frames of animations
  159.     patch_t*    p[3]; 
  160.  
  161.     // following must be initialized to zero before use!
  162.  
  163.     // next value of bcnt (used in conjunction with period)
  164.     int        nexttic;
  165.  
  166.     // last drawn animation frame
  167.     int        lastdrawn;
  168.  
  169.     // next frame number to animate
  170.     int        ctr;
  171.     
  172.     // used by RANDOM and LEVEL when animating
  173.     int        state;  
  174.  
  175. } anim_t;
  176.  
  177.  
  178. static point_t lnodes[NUMEPISODES][NUMMAPS] =
  179. {
  180.     // Episode 0 World Map
  181.     {
  182.     { 185, 164 },    // location of level 0 (CJ)
  183.     { 148, 143 },    // location of level 1 (CJ)
  184.     { 69, 122 },    // location of level 2 (CJ)
  185.     { 209, 102 },    // location of level 3 (CJ)
  186.     { 116, 89 },    // location of level 4 (CJ)
  187.     { 166, 55 },    // location of level 5 (CJ)
  188.     { 71, 56 },    // location of level 6 (CJ)
  189.     { 135, 29 },    // location of level 7 (CJ)
  190.     { 71, 24 }    // location of level 8 (CJ)
  191.     },
  192.  
  193.     // Episode 1 World Map should go here
  194.     {
  195.     { 254, 25 },    // location of level 0 (CJ)
  196.     { 97, 50 },    // location of level 1 (CJ)
  197.     { 188, 64 },    // location of level 2 (CJ)
  198.     { 128, 78 },    // location of level 3 (CJ)
  199.     { 214, 92 },    // location of level 4 (CJ)
  200.     { 133, 130 },    // location of level 5 (CJ)
  201.     { 208, 136 },    // location of level 6 (CJ)
  202.     { 148, 140 },    // location of level 7 (CJ)
  203.     { 235, 158 }    // location of level 8 (CJ)
  204.     },
  205.  
  206.     // Episode 2 World Map should go here
  207.     {
  208.     { 156, 168 },    // location of level 0 (CJ)
  209.     { 48, 154 },    // location of level 1 (CJ)
  210.     { 174, 95 },    // location of level 2 (CJ)
  211.     { 265, 75 },    // location of level 3 (CJ)
  212.     { 130, 48 },    // location of level 4 (CJ)
  213.     { 279, 23 },    // location of level 5 (CJ)
  214.     { 198, 48 },    // location of level 6 (CJ)
  215.     { 140, 25 },    // location of level 7 (CJ)
  216.     { 281, 136 }    // location of level 8 (CJ)
  217.     }
  218.  
  219. };
  220.  
  221.  
  222. //
  223. // Animation locations for episode 0 (1).
  224. // Using patches saves a lot of space,
  225. //  as they replace 320x200 full screen frames.
  226. //
  227. static anim_t epsd0animinfo[] =
  228. {
  229.     { ANIM_ALWAYS, TICRATE/3, 3, { 224, 104 } },
  230.     { ANIM_ALWAYS, TICRATE/3, 3, { 184, 160 } },
  231.     { ANIM_ALWAYS, TICRATE/3, 3, { 112, 136 } },
  232.     { ANIM_ALWAYS, TICRATE/3, 3, { 72, 112 } },
  233.     { ANIM_ALWAYS, TICRATE/3, 3, { 88, 96 } },
  234.     { ANIM_ALWAYS, TICRATE/3, 3, { 64, 48 } },
  235.     { ANIM_ALWAYS, TICRATE/3, 3, { 192, 40 } },
  236.     { ANIM_ALWAYS, TICRATE/3, 3, { 136, 16 } },
  237.     { ANIM_ALWAYS, TICRATE/3, 3, { 80, 16 } },
  238.     { ANIM_ALWAYS, TICRATE/3, 3, { 64, 24 } }
  239. };
  240.  
  241. static anim_t epsd1animinfo[] =
  242. {
  243.     { ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 1 },
  244.     { ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 2 },
  245.     { ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 3 },
  246.     { ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 4 },
  247.     { ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 5 },
  248.     { ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 6 },
  249.     { ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 7 },
  250.     { ANIM_LEVEL, TICRATE/3, 3, { 192, 144 }, 8 },
  251.     { ANIM_LEVEL, TICRATE/3, 1, { 128, 136 }, 8 }
  252. };
  253.  
  254. static anim_t epsd2animinfo[] =
  255. {
  256.     { ANIM_ALWAYS, TICRATE/3, 3, { 104, 168 } },
  257.     { ANIM_ALWAYS, TICRATE/3, 3, { 40, 136 } },
  258.     { ANIM_ALWAYS, TICRATE/3, 3, { 160, 96 } },
  259.     { ANIM_ALWAYS, TICRATE/3, 3, { 104, 80 } },
  260.     { ANIM_ALWAYS, TICRATE/3, 3, { 120, 32 } },
  261.     { ANIM_ALWAYS, TICRATE/4, 3, { 40, 0 } }
  262. };
  263.  
  264. static int NUMANIMS[NUMEPISODES] =
  265. {
  266.     sizeof(epsd0animinfo)/sizeof(anim_t),
  267.     sizeof(epsd1animinfo)/sizeof(anim_t),
  268.     sizeof(epsd2animinfo)/sizeof(anim_t)
  269. };
  270.  
  271. static anim_t *anims[NUMEPISODES] =
  272. {
  273.     epsd0animinfo,
  274.     epsd1animinfo,
  275.     epsd2animinfo
  276. };
  277.  
  278.  
  279. //
  280. // GENERAL DATA
  281. //
  282.  
  283. //
  284. // Locally used stuff.
  285. //
  286. #define FB 0
  287.  
  288.  
  289. // States for single-player
  290. #define SP_KILLS        0
  291. #define SP_ITEMS        2
  292. #define SP_SECRET        4
  293. #define SP_FRAGS        6 
  294. #define SP_TIME            8 
  295. #define SP_PAR            ST_TIME
  296.  
  297. #define SP_PAUSE        1
  298.  
  299. // in seconds
  300. #define SHOWNEXTLOCDELAY    4
  301. //#define SHOWLASTLOCDELAY    SHOWNEXTLOCDELAY
  302.  
  303.  
  304. // used to accelerate or skip a stage
  305. static int        acceleratestage;
  306.  
  307. // wbs->pnum
  308. static int        me;
  309.  
  310.  // specifies current state
  311. static stateenum_t    state;
  312.  
  313. // contains information passed into intermission
  314. static wbstartstruct_t*    wbs;
  315.  
  316. static wbplayerstruct_t* plrs;  // wbs->plyr[]
  317.  
  318. // used for general timing
  319. static int         cnt;  
  320.  
  321. // used for timing of background animation
  322. static int         bcnt;
  323.  
  324. // signals to refresh everything for one frame
  325. static int         firstrefresh; 
  326.  
  327. static int        cnt_kills[MAXPLAYERS];
  328. static int        cnt_items[MAXPLAYERS];
  329. static int        cnt_secret[MAXPLAYERS];
  330. static int        cnt_time;
  331. static int        cnt_par;
  332. static int        cnt_pause;
  333.  
  334. // # of commercial levels
  335. static int        NUMCMAPS; 
  336.  
  337.  
  338. //
  339. //    GRAPHICS
  340. //
  341.  
  342. // background (map of levels).
  343. static patch_t*        bg;
  344.  
  345. // You Are Here graphic
  346. static patch_t*        yah[2]; 
  347.  
  348. // splat
  349. static patch_t*        splat;
  350.  
  351. // %, : graphics
  352. static patch_t*        percent;
  353. static patch_t*        colon;
  354.  
  355. // 0-9 graphic
  356. static patch_t*        num[10];
  357.  
  358. // minus sign
  359. static patch_t*        wiminus = NULL;
  360.  
  361. // "Finished!" graphics
  362. static patch_t*        finished;
  363.  
  364. // "Entering" graphic
  365. static patch_t*        entering; 
  366.  
  367. // "secret"
  368. static patch_t*        sp_secret;
  369.  
  370.  // "Kills", "Scrt", "Items", "Frags"
  371. static patch_t*        kills;
  372. static patch_t*        secret;
  373. static patch_t*        items;
  374. static patch_t*        frags;
  375.  
  376. // Time sucks.
  377. static patch_t*        time;
  378. static patch_t*        par;
  379. static patch_t*        sucks;
  380.  
  381. // "killers", "victims"
  382. static patch_t*        killers;
  383. static patch_t*        victims; 
  384.  
  385. // "Total", your face, you